export const getData = function(option) {
	const promise = new Promise(function(resolve, reject) {
		let type = option.type || 'post',
			data = option.data || {};
		$.ajax({
			url: option.url,
			type: type,
			data: data,
			dataType: 'json',
			success: function(res) {
				if(res.status === 1) {
					resolve(res.data)
					
				}else {
					reject()
				}
			},
			erroe: function() {
				reject()
			}
		})	
	})
	return promise; 
}


export const chartError = (container) => {
	container.hide();
	let $div = $("<div class='text-center error'></div>");
	$div.html('暂无相关数据，请稍后刷新试试...').appendTo(container.parent());
}


export const removeChartError = (container) => {
	container.show();
	let $divError = container.siblings('.error');
	if($divError != undefined ) {
		$divError.remove();
	}
}

